#ifndef COMMITTEEMANAGERTEST_HPP
#define COMMITTEEMANAGERTEST_HPP

#include <gtest/gtest.h>
#include "CommitteeManager.h"

TEST(CommitteeManagerSerialization, ShoudWorkAsExpected)
{
  Committee one("1", "Duplication Is Evil");
  Committee two("2", "You're Ain't Gonna Need It");
  CommitteeManager manager;
  manager.insert(one);
  manager.insert(two);
  ASSERT_EQ(2, manager.size());

  manager.serialize("./committees.csv");
  manager.deserialize("./committees.csv");

  ASSERT_EQ(2, manager.size());
  const Committee *gotOne = manager.committeeById(one.id());
  const Committee *gotTwo = manager.committeeById(two.id());

  ASSERT_TRUE(gotOne != 0);
  ASSERT_TRUE(gotTwo != 0);
  ASSERT_EQ(one, *gotOne);
  ASSERT_EQ(two, *gotTwo);
}

#endif // COMMITTEEMANAGERTEST_HPP